package by.grsu.coctails.fragments;

import java.util.List;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import by.grsu.coctails.R;
import by.grsu.coctails.db.task.CommonGetAsyncTask;
import by.grsu.coctails.db.task.GetMyIngredientAsyncTask;
import by.grsu.coctails.model.Ingredient;

public class MyIngredientsFragment extends ListIngredientFragment {

	@SuppressWarnings({ "rawtypes" })
	@Override
	public CommonGetAsyncTask getTask(String categoryName) {
		return new GetMyIngredientAsyncTask(getActivity(), categoryName) {

			@Override
			public void onComplete(List<Ingredient> result) {
				success(result);
			}
		};
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.list_ingredient_fragment, container,
				false);
	}

	@Override
	protected void onIngredientChandged(String name, int state) {
		reloadDataFromDB();
	}

	@Override
	public String getTitle() {
		return getString(R.string.my_ingredients);
	}

	
}
